package com.ziiwee.reduce.describe.register;

import com.ziiwee.reduce.describe.ControllerDescribe;
import com.ziiwee.reduce.describe.creators.controllers.ResourceInfoControllerDescribeCreator;
import com.ziiwee.reduce.rest.auto.ResourceInfo;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * @author ziiwee
 * @since 2020/8/21
 */
public class DefaultResourceInfoDescribeRegister implements ResourceInfoDescribeRegister {

    private final int order;

    private final Set<ControllerDescribe> set = new HashSet<>();

    public DefaultResourceInfoDescribeRegister(int order) {
        this.order = order;
    }


    @Override
    public void register(ResourceInfo resourceInfo) {
        set.add(new ResourceInfoControllerDescribeCreator(resourceInfo).create());
    }

    @Override
    public int getOrder() {
        return order;
    }

    @Override
    public Collection<ControllerDescribe> getDescribes() {
        return set;
    }
}
